<!---->
<template>
    <div class="page_subsidytype">
        <common-header :title="'补助类型选择'" :showBack="true"></common-header>
        <div class="pages-main" style="height: calc( 100vh - 45px)">
            <group>
                <radio :options="list" @on-change="chooseItem" v-model="typeid"></radio>
            </group>
        </div>
    </div>
</template>

<script>

    import resident from '../../services/resident'
    import {Group, Radio,XInput} from 'vux'

    export default {
        name: "subsidytype",
        components: {
            Group,
            Radio,
            XInput
        },
        data() {
            return {
                itemId:this.$route.query.itemId,
                familyid: this.$route.query.familyid,
                receiveperson: this.$route.query.receiveperson,
                typename: this.$route.query.typename,
                typeid: this.$route.query.typeid,
                hadjoin: this.$route.query.hadjoin ? true : false,
                amount: this.$route.query.amount,
                sendstatus: this.$route.query.sendstatus ? true : false,
                sendtime: this.$route.query.sendtime ? this.$route.query.sendtime : '',
                receiveaccount: this.$route.query.receiveaccount ? this.$route.query.receiveaccount : '',
                criterion: this.$route.query.criterion ? this.$route.query.criterion : '',
                remarks: this.$route.query.remarks ? this.$route.query.remarks : '',
                list: [],
            }
        },

        created() {

        },
        watch: {},
        mounted() {
            this.getSubsidyinfoTypes();
        },
        methods: {
            getSubsidyinfoTypes() {
                this.list = [];
                let _param = this.$tools.invokeUAF('subsidyinfo/getSubsidyinfoTypes', {
                    receiveperson: this.receiveperson,
                })
                resident.getSubsidyinfoTypes(_param).then(res => {
                    let data = res.data.data;
                    if (data) {
                        data.forEach(item => {
                            let param = {
                                key: item.typeId,
                                value: item.typeName,
                            }
                            this.list.push(param)
                        })
                    }
                })
            },

            chooseItem(value, label) {
                console.log(value, label)
                this.typename = label;
                this.typeid = value;
                this.$tools.goPage_query('subsidy', {
                    itemId:this.itemId,
                    familyid:this.familyid,
                    id: this.receiveperson,
                    typeid: this.typeid,
                    typename: this.typename,
                    hadjoin: this.hadjoin ? 1 : 0,
                    amount: this.amount,
                    sendstatus: this.sendstatus,
                    sendtime: this.sendtime,
                    receiveaccount: this.receiveaccount,
                    criterion: this.criterion,
                    remarks: this.remarks,
                })
            },
        },
    };
</script>

<style lang="less" rel="stylesheet/less" type="text/css">

</style>